package com.baosight.sczx.zm.cm.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cm.domain.ZMCMMaterialBaseHisDetail;


/**材料使用管理--库存管理-结转明细
 * <p>Title: ServiceZMCM92.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 杨鸣
 * @version 1.0
 * <pre>Histroy:
 *          2011-5-30 上午09:49:43  杨鸣  Create
 *</pre>
 */

public class ServiceZMCM92 extends ServiceEPBase {

	/**初始数据
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCM02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-30 上午09:49:43  杨鸣
	 * </p>
	 *
	*/
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cs.units",true));
		return outInfo;
	}

	/**列表查询
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCM02</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-30 上午09:49:43  杨鸣
	 * </p>
	 *
	*/
	@Override
	public EiInfo query(EiInfo inInfo) {

		//通过主表ID fdHisKeyId 建立和材料树的关系
		String fdHisKeyId = inInfo.getString("fdHisKeyId");
		StaticTools.setQueryParameters(inInfo, "fdHisKeyId",fdHisKeyId,true);//添加查询条件
		EiInfo outInfo = super.query(inInfo, "ZMCMMaterialBaseHisDetail.query", new ZMCMMaterialBaseHisDetail());
		//此处需要修改
		//outInfo.addBlock(getIsAddTypeInfo(treeTypeInnerCode));
		return outInfo;

	}

	/**查询出入库明细
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: EiInfo</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-10-13 上午09:49:43  王堃
	 * </p>
	 *
	*/
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public EiInfo queryImNExportDetail(EiInfo inInfo) 
	{
		String fdYear = inInfo.getString("fdYear");
		String fdMonth = inInfo.getString("fdMonth");
		String fdMaterialId = inInfo.getString("fdMaterialId");
		
		StaticTools.setQueryParameters(inInfo, "fdMaterialId", fdMaterialId, true);//添加查询条件
		StaticTools.setQueryParameters(inInfo, "fdYear", fdYear, true);//添加查询条件
		StaticTools.setQueryParameters(inInfo, "fdMonth", fdMonth, true);//添加查询条件
		
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = super.query(inInfo, "ZMCMMaterialBaseHisDetail.queryImNExportDetail", new ZMCMMaterialBaseHisDetail());

		return outInfo;

	}
}
